<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>进销存管理系统-编辑分类</title>
<link rel="stylesheet" href="${ctx}/bootstrap3/css/bootstrap.min.css">
<link rel="stylesheet" href="${ctx}/css/my.css">
<link href="${ctx}/My97DatePicker/skin/WdatePicker.css" rel="stylesheet">
<script  type="text/javascript" src="${ctx}/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
	<!-- 导航条 -->
	<jsp:include page="/mng/nav.jsp"/>
	<!-- /导航条 -->
	
	<!-- 主容器 -->
	<div class="container" style="margin-top: 76px">
	  <div class="row">
		<!-- 功能菜单 -->
		<jsp:include page="/mng/menu.jsp"/>
		<!-- /功能菜单 -->
		
		<!-- 主界面 -->
		<div id="main" class="main col-md-9">
			<!-- 路径导航 -->
			<ol class="breadcrumb" style="border-radius: 0;background: #fff;">
			  <li><a href="${ctx}/mng/main.jsp">首页</a></li>
			  <li><a href="#">基础数据管理</a></li>
			  <li class="active">编辑供应商信息</li>
			</ol>
			<!-- /路径导航 -->
			
			<!-- 表单 -->
			<div class="row">
			<form action="${ctx}/mng/supp/edit.jhtml?id=${supp.id}" method="post" class="form-horizontal" role="from" id="from">
				<div class="form-group">
					<label class="col-md-2 control-label">供应商名称</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="name" id="name" value="${supp.name}">
					</div>
					
					<label class="col-md-2 control-label">供应商地址</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="address" id="address" value="${supp.address}">
		   		    </div>
				</div>
				<div class="form-group">
					<label class="col-md-2 control-label">联络人</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="contact" id="contact"  value="${supp.contact}">
					</div>
					<label class="col-md-2 control-label">电话</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="tel" id="tel"  value="${supp.tel}">
		   		    </div>
				</div>
					<div class="form-group">
					<label class="col-md-2 control-label">邮政编码</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="code" id="code"  value="${supp.code}">
					</div>
					<label class="col-md-2 control-label">电子邮件</label>
					<div class="col-md-3">
						<input type="text" class="form-control" name="email"  id="email" value="${supp.email}">
		   		    </div>
				</div>
				
				<div class="form-group">
					<label class="col-md-2 control-label">备注</label>
					<div class="col-md-8">
						<textarea name="remark" rows="3" cols="30" placeholder="这里输入描述信息" class="form-control">${supp.remark}</textarea>
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-2 col-md-offset-3">
						<input type="button"  onclick="tijiao()"  class="form-control btn-primary" value="提交"></input>
					</div>
					<div class="col-md-2 col-md-offset-1">
						<button type="reset" class="form-control btn-warning">重置</button>
					</div>
				</div>
			</form>
			</div>
			<!-- /表单 -->
			
		</div>
		<!-- /主界面 -->
	  </div>
	</div>
<script src="${ctx}/js/jquery-1.11.1.min.js"></script>
<script src="${ctx}/bootstrap3/js/bootstrap.min.js"></script>
<script src="${ctx}/js/my.js"></script>
<script>
       function tijiao(){
    	   
			var name= $("#name").val();  
			var address= $("#address").val(); 
			var contact= $("#contact").val(); 
			var code= $("#code").val(); 
			var email= $("#email").val(); 
			var tel= $("#tel").val(); 
			if(name.length==0||name==null){  
			     alert("供应商名称不能为空");
			     return false;
			} 
			if(address.length==0||address==null){  
			     alert("地址不能为空");
			     return false;
			} 
			if(contact.length==0||contact==null){  
			     alert("联络人不能为空");
			     return false;
			} 
			if(code.length==0||code==null){  
				
			     alert("邮编不能为空");
			     return false;
			}
			if(tel.length==0||tel==null){  
				
			     alert("电话不能为空");
			     return false;
			}
			 if(tel.length!=0){
				var reg  =new RegExp( /^[0-9]{11}$/);
				var flag = reg.test(tel);
				 if(flag==false){
			    	 alert("请输入11位数字！");
			    	 return false;
				
			}
			
			if(email.length==0||email==null){  
			     alert("邮箱不能为空");
			     return false;
			}
			 if(email.length!=0){
				var reg  =new RegExp( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{1,18})+$/);
				var flag = reg.test(email);
			     if(flag==false){
			    	 alert("请输入正确邮箱格式！");
			    	 return false;
			}
			$("#from").submit();
			
		}
	}
}
	</script>
</body>
</html>